package com.ldk.base.framework.util;

import java.util.Properties;

import org.apache.commons.lang.StringUtils;

public class ConfigUtil {
	
	private static ConfigUtil instance;

	public synchronized static ConfigUtil GetInstance() {
		if (null == instance) {
			instance = new ConfigUtil();
		}

		return instance;
	}

	private Properties config;

	/**
	 * @return the config
	 */
	public Properties getConfig() {
		return config;
	}

	/**
	 * @param config
	 *            the config to set
	 */
	public void setConfig(Properties config) {
		this.config = config;
	}
	
	/**
	 * 获取配置属性值
	 * @param key
	 * @return
	 */
	public String getConfigValue(String key){
		if(StringUtils.isBlank(key)) return "";
		if(this.config == null) return "";
		return this.config.containsKey(key) ? this.config.getProperty(key) : "";
	}
}
